include ../../rules.mk
include ../../opencl.mk


SOURCES := ocl_test_driver.c ocl_test_context.c ocl_test_builtins.c
OBJECTS := $(call to_object,$(SOURCES))
DEPENDS := $(OBJECTS:.o=.d)

all: enter  programs leave
	@echo "====> Finished"

enter:
	@echo "==> building in $(HERE)"

leave:
	@echo "==> all done in $(HERE)"

programs : libs ocl_test_driver ocl_test_context ocl_test_builtins

libs:
	@$(MAKE) -s -C ../../mds
	@$(MAKE) -s -C ..

ocl_test_driver: $(call to_object,ocl_test_driver.c) ../../.libs/libocl.a ../../.libs/libmds.a
	$(LINK)  $(OCL_LDFLAGS)

ocl_test_context: $(call to_object,ocl_test_context.c) ../../.libs/libocl.a ../../.libs/libmds.a
	$(LINK) $(OCL_LDFLAGS)
	
ocl_test_builtins: $(call to_object,ocl_test_builtins.c) ../../.libs/libocl.a ../../.libs/libmds.a
	$(LINK) $(OCL_LDFLAGS)

clean:
	$(CLEAN) 
	@rm -f ocl_test_driver   ocl_test_driver.exe
	@rm -f ocl_test_context  ocl_test_context.exe
	@rm -f ocl_test_builtins ocl_test_builtins.exe

rebuild:
	@$(MAKE) -s -C .. clean && $(MAKE) -s -C ../../mds clean && $(MAKE) -s all
	
-include $(DEPENDS)

